import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '@/views/HomeView'
import LoginView from "@/views/LoginView.vue"
import CheckItem from '@/views/order/CheckItem'
import CheckGroup from "@/views/order/CheckGroup"
import SetMeal from "@/views/order/SetMeal.vue"
import Setting from "@/views/order/Setting.vue"
import Profile from "@/views/member/profile.vue"
import List from "@/views/order/List.vue"
import MemberReport from "@/views/report/Member.vue"
import SetMealReport from "@/views/report/SetMeal.vue"
import BusinessReport from "@/views/report/Business.vue"

Vue.use(VueRouter)

const routes = [
  {
    // 主页面
    path: '/',
    name: '主页面',
    component: HomeView,
    redirect: '/studio', // 默认子页面
    meta: {
      requiresAuth: true
    },
    children: [
      {
        // 用户管理
        path: '/system/user',
        name: '用户管理',
        component: () => import('@/views/system/User.vue'),
        meta: {
          requiresAuth: true
        }
      },
      {
        // 工作台页面
        path: '/studio',
        name: '工作台',
        component: () => import('@/views/Studio.vue'),
        meta: {
          requiresAuth: true
        }
      },
      {
        // 角色管理
        path: '/system/role',
        name: '角色管理',
        component: () => import('@/views/system/Role.vue'),
        meta: {
          requiresAuth: true
        }
      },
      {
        // 菜单管理
        path: '/system/menu',
        name: '菜单管理',
        component: () => import('@/views/system/Menu.vue'),
        meta: {
          requiresAuth: true
        }
      },
      {
        // 套餐占比
        path: '/report/business',
        name: '运营数据',
        component: BusinessReport,
        meta: {
          requiresAuth: true
        }
      },
      {
        // 套餐占比
        path: '/report/setMeal',
        name: '套餐占比',
        component: SetMealReport,
        meta: {
          requiresAuth: true
        }
      },
      {
        // 会员统计
        path: '/report/member',
        name: '会员统计',
        component: MemberReport,
        meta: {
          requiresAuth: true
        }
      },
      {
        // 预约列表
        path: '/order/list',
        name: '预约列表',
        component: List,
        meta: {
          requiresAuth: true
        }
      },
      {
        // 预约设置
        path: '/order/setting',
        name: '预约设置',
        component: Setting,
        meta: {
          requiresAuth: true
        }
      },
      {
        // 会员档案
        path: '/member/profile',
        name: '会员档案',
        component: Profile,
        meta: {
          requiresAuth: true
        }
      },
      {
        // 套餐
        path: '/order/setMeal',
        name: '套餐管理',
        component: SetMeal,
        meta: {
          requiresAuth: true
        }
      },
      {
        // 检查项
        path: '/order/checkItem',
        name: '检查项管理',
        component: CheckItem,
        meta: {
          requiresAuth: true
        }
      },
      {
        // 检查组
        path: '/order/checkGroup',
        name: '检查组管理',
        component: CheckGroup,
        meta: {
          requiresAuth: true
        }
      },{
        // 登录页面
        path: '/404',
        name: '未找到',
        component: () => import('@/views/404.vue')
      },
    ],
  },{
    // 登录页面
    path: '/login',
    name: 'login',
    component: LoginView
  },{
    // 跳转到404页面
    path: '*',
    redirect: '/404'
  }

  // {
  //   path: '/about',
  //   name: 'about',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/MainView.vue')
  // }
]

const router = new VueRouter({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})

export default router
